{% set background_colours = {
    'Male': ('bg-male', 'gender-male'),
    'Female': ('bg-female', 'gender-female'),
    'Trans': ('bg-trans', 'gender-trans'),
    'Intersex': ('bg-trans', 'gender-ambiguous'),
    'Non Binary': ('bg-trans', 'gender-neuter'),
    'Transgender Female': ('bg-trans', 'gender-trans'),
    'Transgender Male ': ('bg-trans', 'gender-trans'),
    'default': ('bg-default', None),
} %}
{% set performers_limit = 5 %}

{% set file=file['looked_up'] %}
{% if file['performers'] %}
    {% set scene_performers = file['performers'][:performers_limit] %}
    {% set other_performer = file['performers'][performers_limit:] %}

    {% for performer in scene_performers %}
        {% set gender = performer['role'] if performer['role'] in background_colours else 'default' %}
        {% set background_colour, gender_icon = background_colours[gender] %}

        {% with name = performer['name'] %}
            {% set background_colour, gender_icon = background_colours[gender] %}
            {% include 'render/performerBadge.html' %}
        {% endwith %}
    {% endfor %}

    {% if other_performer %}
        {% with name = 'and ' ~ other_performer|count ~ ' more' %}
            {% set tooltip = other_performer|map(attribute='name')|join(', ') %}
            {% set background_colour, gender_icon = background_colours['default'] %}
            {% include 'render/performerBadge.html' %}
        {% endwith %}
    {% endif %}
{% endif %}
